fix: validate the effective configuration#2352
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes validation to run against the effective model configuration (the configuration after merging any stored profile/defaults with the request overrides) instead of validating only the original request configuration.
Changes:
- Update worker-side validation to validate
ModelInputagainststorageService.getConfiguration(id)(viaConfiguration.getSafeModelConfig(...)) rather thanModelRequest.getModelConfig(). - Update REST
/validation-resultendpoint to validateModelInputagainst the effective stored configuration instead of the request configuration. - Remove now-unused
ModelRequestimport fromSolverWorker.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| model/worker/src/main/java/ai/timefold/solver/model/worker/impl/SolverWorker.java | Switch validation to use stored ModelInput + effective stored configuration. |
| model/rest/src/main/java/ai/timefold/solver/model/rest/impl/AbstractModelAPIResource.java | Switch validation endpoint to use stored ModelInput + effective stored configuration. |
b81d6bc to
2d4645b
Compare
winklerm
left a comment
There was a problem hiding this comment.
Thank you, looks good to me!
triceo
left a comment
There was a problem hiding this comment.
Please use var consistently; both files have var only selectively, yet the code introduces lines where var is an obvious win.
I recommend configuring IntelliJ to show that as soft-warning, and then mass-fixing that on the entire file; there is a keyboard shortcut for it which I currently don't remember. :-)
LGTM when that's done.
0d035d5 to
e8aeb81
Compare
|


Fixes an issue that we validate the original configuration coming from a request, but not the effective configuration that is created by merging the configuration profile with the request configuration.
Tested with a custom version of field-service-routing in the sandbox environment.